package com.rentcars.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.rentcars.entity.Credit;
import com.rentcars.mapper.CreditMapper;
import com.rentcars.service.CreditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 任梦强
 */
@Service("CreditService")
public class CreditServiceImpl implements CreditService {
    @Autowired
    private CreditMapper creditMapper;

    @Override
    public PageInfo<Credit> selectAllCredit(Credit credit,Integer curr, Integer pageSize) {
        PageHelper.startPage(curr,pageSize);
        List<Credit>credits=creditMapper.selectAllCredit(credit);
        return new PageInfo<Credit>(credits);
    }

    @Override
    public int insertSelective(Credit credit) {
        return creditMapper.insertSelective(credit);
    }

    @Override
    public Credit selectCreditById(String cid) {
        return creditMapper.selectCreditById(cid);
    }

    @Override
    public int updateCredit(Credit credit) {
        return creditMapper.updateCredit(credit);
    }

    @Override
    public int deleteByCid(String cid) {
        return creditMapper.deleteByCid(cid);
    }

    @Override
    public int delCredit(List<String> cidList) {
        return creditMapper.delCredit(cidList);
    }

    public CreditMapper getCreditMapper() {
        return creditMapper;
    }

    public void setCreditMapper(CreditMapper creditMapper) {
        this.creditMapper = creditMapper;
    }
}
